var t = 0, a = 0;

Component({
    properties: {
        goodsData: {
            type: null
        },
        cardid: {
            type: null
        }
    },
    lifetimes: {
        attached: function() {
            t = 0, a = 0;
        }
    },
    data: {
        activitys1: [],
        activitys2: [],
        showLoading: !1,
        imgCount: 0
    },
    methods: {
        toVideo: function(t) {
            var a = t.currentTarget.dataset.item, i = this.data.goodsData.findIndex(function(t, i, o) {
                return t.id === a.id;
            });
            i = Math.ceil((i + 1) / 15), wx.navigateTo({
                url: "/packageC/video_goods/VideoDetail/VideoDetail?vid=" + a.id + "&page=" + i + "&from=card&card_id=" + this.data.cardid
            });
        },
        onImageLoad: function(i) {
            console.log(i), console.log(this.data);
            var o = i.currentTarget.id, d = i.detail.width, e = i.detail.height, s = this.data.goodsData, n = null, h = d / e;
            console.log(this.data.allData);
            for (var g = 0; g < s.length; g++) if (s[g].id == o) {
                n = s[g];
                break;
            }
            this.data.imgCount += 1;
            var l = this.data.activitys1, r = this.data.activitys2;
            t <= a ? (t += 176 / h + 60, l.push(n)) : (a += 176 / h + 60, r.push(n));
            var c = {
                activitys1: l,
                activitys2: r
            };
            console.log(this.data.imgCount, this.data.goodsData.length), this.data.imgCount >= this.data.goodsData.length && this.setData({
                showLoading: !0
            }), this.setData(c);
        }
    }
});